added samples
[windows-sources.git] / sdk / samples / all in on code / Visual Studio 2008 / VBTabbedWebBrowser / WebBrowserTabPage.vb
bloba2ae5efb470b8959371b94747f247b3fc2a27838
1 '*************************** Module Header ******************************'
2 ' Module Name: WebBrowserTabPage.vb
3 ' Project: VBTabbedWebBrowser
4 ' Copyright (c) Microsoft Corporation.
5 '
6 ' This class inherits the the System.Windows.Forms.TabPage class and contains
7 ' a WebBrowserEx property. An instance of this class could be add to a tab control
8 ' directly.
9 '
10 ' It exposes the NewWindow3 event of WebBrowserEx, and handle the DocumentTitleChanged
11 ' event.
13 ' This source is subject to the Microsoft Public License.
14 ' See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
15 ' All other rights reserved.
17 ' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
18 ' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
19 ' WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
20 '*************************************************************************'
22 Imports System.Security.Permissions
24 Public Class WebBrowserTabPage
25 Inherits TabPage
26 Private _webBrowser As WebBrowserEx
27 Public Property WebBrowser() As WebBrowserEx
28 Get
29 Return _webBrowser
30 End Get
31 Private Set(ByVal value As WebBrowserEx)
32 _webBrowser = value
33 End Set
34 End Property
36 ' Expose the NewWindow3 event of WebBrowserEx.
37 Public Custom Event NewWindow As EventHandler(Of WebBrowserNewWindowEventArgs)
38 AddHandler(ByVal value As EventHandler(Of WebBrowserNewWindowEventArgs))
39 AddHandler WebBrowser.NewWindow3, value
40 End AddHandler
41 RemoveHandler(ByVal value As EventHandler(Of WebBrowserNewWindowEventArgs))
42 RemoveHandler WebBrowser.NewWindow3, value
43 End RemoveHandler
44 RaiseEvent()
45 End RaiseEvent
46 End Event
48 ''' <summary>
49 ''' Initialize the WebBrowserEx instance.
50 ''' </summary>
51 <PermissionSetAttribute(SecurityAction.LinkDemand, Name:="FullTrust")> _
52 Public Sub New()
53 MyBase.New()
54 WebBrowser = New WebBrowserEx()
55 WebBrowser.Dock = DockStyle.Fill
56 AddHandler WebBrowser.DocumentTitleChanged, AddressOf WebBrowser_DocumentTitleChanged
58 Me.Controls.Add(WebBrowser)
59 End Sub
61 ''' <summary>
62 ''' Change the title of the tab page.
63 ''' </summary>
64 Private Sub WebBrowser_DocumentTitleChanged(ByVal sender As Object, ByVal e As EventArgs)
65 Me.Text = WebBrowser.DocumentTitle
66 End Sub
68 End Class